package com.durian.affairs.service.impl;

import com.durian.affairs.api.domain.CwReceiptPlan;
import com.durian.affairs.mapper.CwReceiptPlanMapper;
import com.durian.affairs.service.ICwReceiptPlanService;
import com.durian.common.core.utils.DateUtils;
import com.durian.financial.api.domain.vo.ContractVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 收款计划Service业务层处理
 * 
 * @author durian
 * @date 2022-06-25
 */
@Service
public class CwReceiptPlanServiceImpl implements ICwReceiptPlanService 
{
    @Autowired
    private CwReceiptPlanMapper cwReceiptPlanMapper;

    /**
     * 查询收款计划
     * 
     * @param id 收款计划主键
     * @return 收款计划
     */
    @Override
    public CwReceiptPlan selectCwReceiptPlanById(Long id)
    {
        return cwReceiptPlanMapper.selectCwReceiptPlanById(id);
    }

    /**
     * 查询收款计划列表
     * 
     * @param cwReceiptPlan 收款计划
     * @return 收款计划
     */
    @Override
    public List<CwReceiptPlan> selectCwReceiptPlanList(CwReceiptPlan cwReceiptPlan)
    {
        return cwReceiptPlanMapper.selectCwReceiptPlanList(cwReceiptPlan);
    }

    /**
     * 新增收款计划
     * 
     * @param cwReceiptPlan 收款计划
     * @return 结果
     */
    @Override
    public int insertCwReceiptPlan(CwReceiptPlan cwReceiptPlan)
    {
        cwReceiptPlan.setCreateTime(DateUtils.getNowDate());
        return cwReceiptPlanMapper.insertCwReceiptPlan(cwReceiptPlan);
    }

    /**
     * 修改收款计划
     * 
     * @param cwReceiptPlan 收款计划
     * @return 结果
     */
    @Override
    public int updateCwReceiptPlan(CwReceiptPlan cwReceiptPlan)
    {
        cwReceiptPlan.setUpdateTime(DateUtils.getNowDate());
        return cwReceiptPlanMapper.updateCwReceiptPlan(cwReceiptPlan);
    }

    /**
     * 批量删除收款计划
     * 
     * @param ids 需要删除的收款计划主键
     * @return 结果
     */
    @Override
    public int deleteCwReceiptPlanByIds(Long[] ids)
    {
        return cwReceiptPlanMapper.deleteCwReceiptPlanByIds(ids);
    }

    /**
     * 删除收款计划信息
     * 
     * @param id 收款计划主键
     * @return 结果
     */
    @Override
    public int deleteCwReceiptPlanById(Long id)
    {
        return cwReceiptPlanMapper.deleteCwReceiptPlanById(id);
    }

    /**
     * 根据合同信息获取对应计划列表
     *
     * @param vo
     * @return
     */
    @Override
    public List<CwReceiptPlan> selectCwReceiptPlanByContract(ContractVO vo) {
        return cwReceiptPlanMapper.selectCwReceiptPlanByContract(vo);
    }

    /**
     * 修改收款计划状态
     *
     * @param cwReceiptPlan
     */
    @Override
    public int updateStatus(CwReceiptPlan cwReceiptPlan) {
        return cwReceiptPlanMapper.updateStatus(cwReceiptPlan);
    }
}
